package com.vrv.netmgr.assets.detail;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageButton;
import android.widget.TextView;

import com.vrv.netmgr.R;
import com.vrv.netmgr.vo.SerializableAssetsQry;

/**
 * @Description 注册资产查询策略详细信息
 * @author yangzijian
 * @date
 *
 */
public class DetailAssetsQryActivity extends Activity {
    //
    private SerializableAssetsQry info;

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
        setContentView(R.layout.detail_assetsqry);
        getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.common_title);
        getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
        //
        initViews();
        setTitle();
    }

    //
    public void initViews() {
        //
        TextView className = (TextView) findViewById(R.id.assetsqry_class);
        TextView unitName = (TextView) findViewById(R.id.assetsqry_unit);
        TextView depName = (TextView) findViewById(R.id.assetsqry_dep);
        TextView tel = (TextView) findViewById(R.id.assetsqry_tel);
        TextView userName = (TextView) findViewById(R.id.assetsqry_user);
        TextView devIp = (TextView) findViewById(R.id.assetsqry_ip);
        TextView macAddr = (TextView) findViewById(R.id.assetsqry_mac);
        TextView devName = (TextView) findViewById(R.id.assetsqry_dev);
        TextView hardWare = (TextView) findViewById(R.id.assetsqry_info);
        TextView basicHardWare = (TextView) findViewById(R.id.basic_hardware_info);
        //
        info = (SerializableAssetsQry) getIntent().getSerializableExtra("info");
        //
        className.setText(info.getCLASS_NAME());
        unitName.setText(info.getUNIT_NAME());
        depName.setText(info.getDEP_NAME());
        tel.setText(info.getTEL());
        userName.setText(info.getUSER_NAME());
        devIp.setText(info.getDEV_IP());
        macAddr.setText(info.getMAC_ADDR());
        devName.setText(info.getDEV_NAME());
        hardWare.setText(info.getHARDWARE_INFO());
        basicHardWare.setText(info.getBasicHDInfo());
    }

    public void setTitle() {
        TextView title = (TextView) findViewById(R.id.title_text);
        title.setText("注册资产查询" + "[" + info.DEV_IP + "]");

        /**
         * 返回按钮
         */
        ImageButton backBtn = (ImageButton) findViewById(R.id.backBtn);
        backBtn.setVisibility(View.VISIBLE);
        backBtn.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                onBackPressed();
            }
        });
    }

    @Override
    public void onBackPressed() {
        finish();
        overridePendingTransition(R.anim.push_right_out, R.anim.push_right_in);
        super.onBackPressed();
    }
}
